# Contributor: k0r10n <k0r10n.dev@gmail.com>
# Contributor: Jose-Luis Rivas <ghostbar@riseup.net>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=libzip
pkgver=1.7.3
pkgrel=1
pkgdesc="C library for manipulating zip archives"
url="http://www.nih.at/libzip/index.html"
arch="all"
license="BSD-3-Clause"
depends_dev="zlib-dev xz-dev"
makedepends="$depends_dev cmake openssl-dev perl"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
source="https://www.nih.at/libzip/libzip-$pkgver.tar.xz"

# secfixes:
#   1.3.0-r0:
#     - CVE-2017-14107

build() {
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_C_FLAGS="$CFLAGS"
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" -j1 install
}

tools() {
	pkgdesc="$pkgname cmp and merge tools"
	install -d "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

sha512sums="488866348a0c859f6f995c50e956bd51b4105278f07b63fe019cb44ab36c09ef958cc0684fd5444c474d83874b999e8ed1aa9b2da51b74caa37bbe7934b9c870  libzip-1.7.3.tar.xz"
